<? 
	if(isset($_POST['addsubmit']))
	{
		require("required/dbconnect.php");
		require("required/function.php");
		
		$album_name_eng=$_POST['album_name_eng'];
		$cat_id=$_POST['cat_id'];
		
		
		
		$update=mysql_query("insert into os_photoalbum (album_name_eng,cat_id,add_date)values
							('$album_name_eng','$cat_id',now())")or die(mysql_error());
		header("Location:photo_album.php?action=1");	
	}
	
	$title="Add Album"; 
	
	
	require("required/dbconnect.php");	
	require("required/header.php");
	require("required/function.php");
	

	
	
?>
<table width="100%"  cellpadding="0" cellspacing="5" height="300">
<script language="JavaScript" type="text/javascript" src="wysiwyg.js">
</script>
<script type="text/javascript" src="required/js/calendarDateInput.js"></script>		
	<td width="16%" valign="top">
		<? require("required/menu.php") ?>
	</td>
<td valign="top">
	<table width="80%" cellpadding="2" cellspacing="1">
		<tr height="20">
			<td colspan="2" class="title">Add Album</td>
		</tr>
		<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post" name="frm">
		<tr>
			<td>Album Name</td><td><input type="text" maxlength="200" name="album_name_eng" class="text" size="50"></td>
		</tr>
     	 <tr>
			<td>Category</td><td>
            <?
				$get_cat=mysql_query("select * from os_gallery_category order by cat_name asc");
			?>
            <select name="cat_id">
            	<option>Please select</option>
                <?
					while($c=mysql_fetch_array($get_cat,MYSQL_ASSOC))
					{
				?>
                <option value="<?= $c['id'] ?>"><?= $c['cat_name'] ?></option>
                <? } ?>
            </select>
            
            </td>
		</tr>
		
		<tr>
			<td colspan="2">
            	<input type="submit" value="Add" class="button" name="addsubmit">
            	<input type="button" value="Back" class="button" name="addsubmit" onclick="window.open('photo_album.php','_self')">
            </td>
		</tr>
		</form>
	</table>
</td>
</table>
<? require("required/footer.php"); ?>

